﻿using Microsoft.AspNetCore.Mvc.Filters;
using MiniFox.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;

namespace MiniFox.Web.Infrastructure
{
    /// <summary>
    /// 
    /// </summary>
    public class NoCacheAttribute : ActionFilterAttribute
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionExecutedContext"></param>
        public override void OnActionExecuted(ActionExecutedContext actionExecutedContext)
        {
            var httpContext = actionExecutedContext.HttpContext;
            if (httpContext.Response != null)
            {
                httpContext.Response.Headers.CacheControl.Append("no-cache");

            }
        }
    }
}
